package com.example.demo.redis;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;

/**
 * Created by liujiahao on 2019/4/19.
 */
@Configuration
@Slf4j
public class RedisConfig {
    @Value("${spring.redis.host}")
    private  String host;
    @Value("${spring.redis.port}")
    private  Integer port;
    @Bean
    public JedisPool getJedisPool(){
        log.info(host+port);
        JedisPoolConfig config=new JedisPoolConfig();
        JedisPool pool=new JedisPool(config,host,port);
        return pool;
    }
}
